#ifndef __CE_GFX_GL20_TEXTURE_H__
#define __CE_GFX_GL20_TEXTURE_H__

#include <gfx/itexture.h>
#include <GL/glew.h>

/**
 * \addtogroup opengl
 * @{
 */

/**
 * @brief OpenGL implemenation of the iTexture2D interface.
 */
class ceTexture2D : public iTexture2D
{
  CE_OBJECT
private:
  ceRect  _size;

  GLuint      _name;

  bool        _mipMap;

  unsigned    _anisotropic;

  ceWrapMode  _wrapMode;

  ceFilter    _filter;

  GLenum      _internalFormat;

  void UpdateFilter ();

public:
	ceTexture2D();

  ceTextureType GetTextureType () const { return TT_Texture2D; }
  GLuint GetName () const { return _name; }

  void Bind ();

  bool Create (const ceTextureDescriptor& desc);
  bool Convert (const ceTextureDescriptor& desc);

  virtual void SetMipMap(bool mipMap);
  virtual bool IsMipMap () const;

  virtual void SetAnisotropic (unsigned anisotropic);
  virtual unsigned GetAnisotropic () const;

  virtual void SetWrapMode (ceWrapMode wrapMode);
  virtual ceWrapMode GetWrapMode () const;

  virtual void SetFilter (ceFilter filter);
  virtual ceFilter GetFilter () const;

  virtual void SetData (cePixelFormat, void* data);
  virtual void CopyData(unsigned level, const ceRect &rect, cePixelFormat format, const void *data);

};

/** @} */

#endif /* ! __CE_GFX_GL20_TEXTURE_H__ */
